﻿// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace MyEFCore;

public class RepositoryManager : IRepositoryManager
{
    private readonly MyDbContext _myDbContext;
    private readonly IProductRepository _productRepository;

    public RepositoryManager(MyDbContext myDbContext, IProductRepository productRepository)
    {
        _myDbContext = myDbContext;
        _productRepository = productRepository;
    }

    public IProductRepository Product => _productRepository;

    public async Task SaveAsync()
    {
        await _myDbContext.SaveChangesAsync();
    }
}
